import {RefObject, useState} from "react";
import {CalendarPicker, DatePickerRef} from "antd-mobile";
import dayjs from "dayjs";
import 'dayjs/locale/zh-cn';


const DatePicker = (props) => {
    const {isShow, onConfirm} = props;

    return (
        <Form.Item
            name='birthday'
            label='Birthday'
            onClick={(e, datePickerRef: RefObject<DatePickerRef>) => {
                datePickerRef.current?.open() // ⬅️
            }}
        >
            <DatePicker>
                {value =>
                    value ? dayjs(value).format('YYYY-MM-DD') : 'Please select'
                }
            </DatePicker>
        </Form.Item>
    );
}

export default DatePicker;